<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <div class="panel panel-primary">
            <h1>后台管理系统</h1>
            <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>编号</th>
                            <th>姓名</th>
                            <th>年龄</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{each data}}
                        <tr>
                            <td>{{$index}}</td>  
                            <td>{{$value.name}}</td>
                            <td>{{$value.age}}</td>
                            <td>
                                <a href="/delete?id={{@ $value._id}}" class="btn btn-danger">删除</a>
                                <a href="/edit?item={{$value}}" class="btn btn-success">编辑</a>
                            </td>
                        </tr>
                        {{/each}}
                    </tbody>
            </table>
        </div>   
        <a href="/add" class="btn btn-success">增加数据</a>
    </div>
</body>
</html>